package com.myappengine.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.datanucleus.annotations.Unowned;

@PersistenceCapable
public class Student {
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String studentId;
	
	@Persistent
	private String studentName;
	
	@Persistent
	private Integer studentAge;
	
	@Persistent
	private Set<Key> classes = new HashSet<Key>();
	
	@Persistent
	@Unowned
	private Instructor instructor;
	
	@Persistent(mappedBy = "student")
	private List<UploadedFile> uploadedFiles = new ArrayList<UploadedFile>();
	
	public Student() {
		
	}

	public Student(String studentId, String studentName, Integer studentAge) {
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentAge = studentAge;
	}
	
	public Student(String studentId, String studentName, Integer studentAge, Set<Key> classes) {
		this(studentId, studentName, studentAge);
		this.classes = classes;
	}
	
	public Student(String studentId, String studentName, Integer studentAge, Instructor instructor) {
		this(studentId, studentName, studentAge);
		this.instructor = instructor;
	}
	
	public Instructor getInstructor() {
		return instructor;
	}

	public void setInstructor(Instructor instructor) {
		this.instructor = instructor;
	}

	public Set<Key> getClasses() {
		return classes;
	}

	public void setClasses(Set<Key> classes) {
		this.classes = classes;
	}

	public Key getKey() {
		return key;
	}
	
	public String getStudentId() {
		return studentId;
	}

	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public Integer getStudentAge() {
		return studentAge;
	}

	public void setStudentAge(Integer studentAge) {
		this.studentAge = studentAge;
	}

	public List<UploadedFile> getUploadedFiles() {
		return uploadedFiles;
	}

	public void setUploadedFiles(List<UploadedFile> uploadedFiles) {
		this.uploadedFiles = uploadedFiles;
	}
}
